package cn.yudao.ymcc.feign;


import cn.yudao.ymcc.result.JSONResult;
import cn.yudao.ymcc.searchDoc.CourseDoc;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignFallbackFactory implements FallbackFactory<CourseFeign> {

    @Override
    public CourseFeign create(Throwable throwable) {
        return new CourseFeign() {
            @Override
            public JSONResult save(CourseDoc courseDoc) {
                throwable.printStackTrace();
                return JSONResult.error("您的网络有点波动喔");
            }

            @Override
            public JSONResult delete(Long id) {
                throwable.printStackTrace();
                return JSONResult.error("您的网络有点波动喔");
            }
        };
    }
}
